package com.aikon.wht.concurrent;

import lombok.Data;

/**
 * @author haitao.wang
 */
@Data
public class Account extends Thread{
    private double balance;

    public synchronized void addAmount(double amount) {
        balance += amount;
    }

    public synchronized void substractAmount(double amount) {
        balance -= amount;
    }

    public void run() {
        addAmount(1);
        System.out.println(balance);
    }

}
